﻿package core.ui.controls
{
    import flash.display.*;
    import flash.events.*;

    public class OpenImageButton extends Sprite
    {
        var bg:Sprite;

        public function OpenImageButton(param1:BitmapData, param2:String, param3:String, param4:int = 6)
        {
            this.bg = new Sprite();
            addChild(this.bg);
            this.addEventListener(MouseEvent.ROLL_OVER, this.MouseOver, false, 1, true);
            this.addEventListener(MouseEvent.ROLL_OUT, this.MouseOut, false, 1, true);
            var _loc_5:* = new Bitmap(param1);
            _loc_5.x = 10;
            _loc_5.y = param4;
            addChild(_loc_5);
            var _loc_6:* = new Text(U.RM(param2), 16, 3289650, true, false);
            _loc_6.x = 65;
            _loc_6.y = 2;
            addChild(_loc_6);
            var _loc_7:* = new Text(U.RM(param3), 13, 6710886);
            _loc_7.wordWrap = true;
            _loc_7.width = 300;
            _loc_7.multiline = true;
            _loc_7.x = 65;
            _loc_7.y = 22;
            addChild(_loc_7);
            this.MouseOut(null);
            return;
        }// end function

        private function MouseOver(event:MouseEvent) : void
        {
            this.bg.graphics.clear();
            this.bg.graphics.beginFill(10402765);
            this.bg.graphics.drawRect(0, 0, 370, 60);
            this.bg.graphics.beginFill(11324382);
            this.bg.graphics.drawRect(1, 1, 368, 58);
            this.bg.graphics.endFill();
            return;
        }// end function

        private function MouseOut(event:MouseEvent) : void
        {
            this.bg.graphics.clear();
            this.bg.graphics.beginFill(13421772);
            this.bg.graphics.drawRect(0, 0, 370, 60);
            this.bg.graphics.beginFill(14474460);
            this.bg.graphics.drawRect(1, 1, 368, 58);
            this.bg.graphics.endFill();
            return;
        }// end function

    }
}
